home *** CD-ROM | disk | FTP | other *** search
/ 15 Beaut Aussie Games 1 / BEAUTGAMESV1.iso / pc / Windows / data1.cab / Program_Files / dswmedia / games / canetoad.dcr / obstacles_1_obstacles parent.ls < prev    next >
Encoding:
Text File  |  2002-01-01  |  2.1 KB  |  81 lines

  1. property sNumber, sCast, hInit, vInit, hIncr, vIncr, action
  2.  
  3. on new me, spritenumber
  4.   sNumber = spritenumber
  5.   sCast = the castLibNum of sprite sNumber
  6.   hInit = the locH of sprite sNumber
  7.   vInit = the locV of sprite sNumber
  8.   puppetSprite(sNumber, 1)
  9.   init(me)
  10.   return me
  11. end
  12.  
  13. on init me
  14.   hIncr = 0
  15.   vIncr = 15
  16.   set the loc of sprite sNumber to point(hInit, vInit)
  17.   action = "alive"
  18. end
  19.  
  20. on move me
  21.   set the loc of sprite sNumber to the loc of sprite sNumber + point(hIncr, vIncr)
  22.   if the locV of sprite sNumber >= 350 then
  23.     randomize(me)
  24.   end if
  25. end
  26.  
  27. on randomize me
  28.   set the locH of sprite sNumber to 75 + random(250)
  29.   set the locV of sprite sNumber to -random(200)
  30.   case random(6) of
  31.     1:
  32.       set the member of sprite sNumber to member("rock1", sCast)
  33.     2:
  34.       set the member of sprite sNumber to member("rock2", sCast)
  35.     3:
  36.       set the member of sprite sNumber to member("rock3", sCast)
  37.     4:
  38.       set the member of sprite sNumber to member("toad1", sCast)
  39.     5:
  40.       set the member of sprite sNumber to member("toad2", sCast)
  41.     6:
  42.       set the member of sprite sNumber to member("toad3", sCast)
  43.   end case
  44.   action = "alive"
  45. end
  46.  
  47. on hit me
  48.   global hit
  49.   action = "dead"
  50.   case member(the member of sprite sNumber).name of
  51.     "rock1":
  52.       puppetSound(1, "hit.aif")
  53.       calcDamage(gameControl, 1)
  54.       set the loc of sprite hit to the loc of sprite sNumber
  55.     "rock2":
  56.       puppetSound(1, "hit.aif")
  57.       calcDamage(gameControl, 2)
  58.       set the loc of sprite hit to the loc of sprite sNumber
  59.     "rock3":
  60.       puppetSound(1, "hit.aif")
  61.       calcDamage(gameControl, 3)
  62.       set the loc of sprite hit to the loc of sprite sNumber
  63.     "toad1":
  64.       puppetSound(1, "pop" & random(6))
  65.       calcScore(gameControl, 1)
  66.       set the member of sprite sNumber to member("splat1", sCast)
  67.     "toad2":
  68.       puppetSound(1, "bigpop" & random(4))
  69.       calcScore(gameControl, 2)
  70.       set the member of sprite sNumber to member("splat2", sCast)
  71.     "toad3":
  72.       puppetSound(1, "brownpop")
  73.       calcScore(gameControl, 3)
  74.       set the member of sprite sNumber to member("splat3", sCast)
  75.   end case
  76. end
  77.  
  78. on turnOff me
  79.   puppetSprite(sNumber, 0)
  80. end
  81.